var Notification_Panel = {
	Element : v$('notificationpanel'),
	Alert_Icon : 'Notification_Panel_Alert_Icon',
	Has_Messages_SRC : '/a/a/i/new_messages_icon.gif',
	No_Messages_SRC : '/a/a/i/no_messages_icon.gif',
	Close : function(event) {
		var event = FixEvent(event);
		v$('notificationpanel').style['display'] = 'none';
		v$('notificationmaster').style['display'] = 'none';
	},
	Open : function(event) {
		var event = FixEvent(event);
		Notification_Panel.Element.style['display'] = '';
		Notifications = Notification_Panel.Element.childNodes;
		v$('notificationmaster').style['display'] = '';
		//v$('fillscreen').style.display='';
		for (var i = 0; i < Notifications.length; i++) {
			if (Notifications[i].nodeName.toUpperCase() == 'DIV') {
				Notifications[i].style['display'] = '';
			}
		}
		if(Notifications.length==1){
			//v$('fillscreen').style.display='none';
			Notification_Panel.Element.style['display'] = 'none';
		};	
	},
	Mark_Notification_As_Read : function(ID_Notifications) {
		v$('Notification_' + ID_Notifications).parentNode.removeChild(v$('Notification_' + ID_Notifications));
		Notification_Panel.Update_Display();
		v$('Notification_Count').innerHTML=parseInt(v$('Notification_Count').innerHTML)-1;
		sendAjax('GET', '/admin/ajax_receiver.asp?system=notification_panel&action=mark_as_read&ID_Notifications=' + ID_Notifications + '&CustomerID=' + g_CustomerID, null, null, throwAjaxError, false);
		if(parseInt(v$('Notification_Count').innerHTML)==0){
			Notification_Panel.Close();
			v$('Notification_Panel_Alert_Icon').innerHTML='';
		}
	},
	Hide_Notification : function(ID_Notifications) {
		var event = FixEvent(event);
		v$('Notification_' + ID_Notifications).style['display'] = 'none';
		Notification_Panel.Update_Display();
		SetCookie('vsettings', GetCookie('vsettings','HiddenNotifications') + ',' + ID_Notifications + ',', 1 * c_years, 'HiddenNotifications');
	},
	InitializeDisplayOnLoad : function() {
		var hasVisibleNotices = false;
		Notifications = Notification_Panel.Element.childNodes;
		for (var i = 0; i < Notifications.length; i++) {
			if (Notifications[i].nodeName.toUpperCase() == 'DIV' && Notifications[i].id != '') {
				if(Notifications[i].style['display'] == ''){hasVisibleNotices = true;break;}
			}
		}
		if(!hasVisibleNotices)Notification_Panel.Close();
		if(hasVisibleNotices)Notification_Panel.Open();
	},
	Update_Display : function() {
		var hasVisibleNotices = false;
		Notifications = Notification_Panel.Element.childNodes;
		for (var i = 0; i < Notifications.length; i++) {
			if (Notifications[i].nodeName.toUpperCase() == 'DIV' && Notifications[i].id != '') {
				if(Notifications[i].style['display'] == ''){hasVisibleNotices = true;break;}
			}
		}
		if(!hasVisibleNotices){
			Notification_Panel.Close();
			v$('fillscreen').style.display='none';
		}
	}
}